package moocloudstudio.minder.entity;

import cn.hutool.core.util.IdUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import moocloudstudio.minder.enums.ShareType;

import java.time.LocalDateTime;

@ApiModel("分享链接")
@Data
public class MapShare {
    @ApiModelProperty(value = "分享信息id")
    private String shareId;
    @ApiModelProperty("链接是否已开启分享")
    private Boolean shared;
    @ApiModelProperty("链接")
    private String link;
    @ApiModelProperty("分享类型：1:永不过期；2：分享码；3：限时分享")
    private String shareType;
    @ApiModelProperty("分享码")
    private String shareCode;
    @ApiModelProperty("开始分享时间")
    private LocalDateTime startTime;
    @ApiModelProperty("分享时长")
    private int duration;

    public static MapShare createShare(){
        MapShare newShare = new MapShare();
        newShare.setShareId(IdUtil.getSnowflakeNextIdStr());
        newShare.setShared(false);
        newShare.setShareType(ShareType.NoExpiration.getValue());
        newShare.setDuration(0);
        // 链接暂时由前端进行生成
        newShare.setLink("#");
        return newShare;
    }
}

